package com.xxl.job.executor.test;

import com.gargoylesoftware.htmlunit.javascript.host.svg.SVGFEMergeElement;
import com.xxl.job.executor.crawler.XxlCrawler;
import com.xxl.job.executor.crawler.annotation.PageFieldSelect;
import com.xxl.job.executor.crawler.annotation.PageSelect;
import com.xxl.job.executor.crawler.conf.XxlCrawlerConf;
import com.xxl.job.executor.crawler.parser.PageParser;
import lombok.Data;
import org.jsoup.nodes.Document;
import org.jsoup.nodes.Element;
import org.junit.Test;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * 描述:
 *
 * @author Pfly
 * @create 2019-01-05 16:06
 */
public class test4 {


    public static void main(String[] args) {

        /*String  [] txt = s.split("<span class=\"value\">");
                            for (String a : txt){
                                a = getNumbers(a); //截取字符串中的数字
                                if(!a.equals("") || a != null) {
                                    if(a.length() > 4 ){
                                        System.out.println(a);
                                    }
                                }
                            }


    }*/

        String a = "https://saudi.souq.com/sa-en/b1231e-soundsport-free-truly-wireless-sport-headphones-black-27915533/i/";
        String numbers = getNumbers(a);
        System.out.println(numbers);
    }

    public static String getNumbers(String content) {
        Pattern pattern = Pattern.compile("\\d+");
        Matcher matcher = pattern.matcher(content);
        while (matcher.find()) {
            return matcher.group(0);
        }
        return "";
    }


}
